<template>
  <el-menu-item index="10-2" @click="loginOut">退出登入</el-menu-item>
</template>

<script setup>
import { putStateUserHttp, getOneUserhttp } from '../../../request/userHttp'
const $router = useRouter()
const $route = useRoute()
const users = ref()
const loginOut = async () => {
  $router.push('/')
  const res = $route.query
  const user_id = res.id
  const oneuesr = await getOneUserhttp(user_id)
  users.value = oneuesr.data.result
  putStateUserHttp(user_id, users.value.user_name, users.value.user_password)
  localStorage.removeItem('token')
  localStorage.removeItem('user_type')
}
</script>

<style scoped></style>
